function vma_path = estimateVMA(price_path,num_period)

    n = length(price_path);
    temp(1) = price_path(num_period);
    
    % Calculate alpha
    alpha = 2/(num_period+1);
    
    for i = 2:n-num_period+1
        % Volatility Index is used here is Efficiency Ratio (ER)
        direction = abs(price_path(num_period+i-1)-price_path(i-1));
        volatility = 0;
        for j = 1:num_period
            volatility = volatility + abs(price_path(num_period+i-j)-price_path(num_period+i-j-1));
        end
        ER =  direction / volatility;
        % Estimate VMA
        temp(i) = (alpha*ER*price_path(num_period+i-1))...
                     +(1-alpha*ER)*temp(i-1);
    end
    vma_path = temp(2:end);
